
CROSS_COMPILE = arm-linux-
CC = $(CROSS_COMPILE)gcc
CFLAGS = -c -g
LDFLAGS = -lpthread

OBJS = main.o data_global.o pthread_transfer.o \
		pthread_client_request.o pthread_buzzer.o \
		pthread_led.o pthread_sqlite.o pthread_refresh.o\
		pthread_sms.o uart_ctl.o

EOBJ = $(shell if [ -d "./obj" ]; then echo "exist"; else echo "notexist"; fi)
$(info "./obj $(EOBJ)")

monitor_obj :$(OBJS)
	$(CC) -o $@ $^ $(LDFLAGS)
	mv *o ./obj

ifeq ("$(EOBJ)", "notexist")
	$(shell mkdir obj)
endif

$(OBJS):%.o:%.c
	$(CC) $(CFLAGS) $< -o $@

install:
	sudo cp monitor_obj ~/fs4412/sync/rootfs

.PHONY:clean
clean:
	rm *.o obj/*.o monitor_obj -rf
